package wqh.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import wqh.global.GlobalSession;

import javax.servlet.http.HttpServletRequest;

@Controller
@CrossOrigin(origins = "*")
public class MainController {

    @RequestMapping("")
    public ModelAndView login(HttpServletRequest request)
    {
        if(!GlobalSession.existSessionID(request.getSession().getId()))
        {
            return new ModelAndView("login_ftl");
        }
       return new ModelAndView("redirect:/water/view/index");
    }

}
